//       attribute vec4 a_Position;  
//相当于 let a_Position: vec4;
let VSHADER_SOURCE = `
    attribute vec4 a_Position;
    attribute float a_PointSize;

    void main(){
        gl_Position = a_Position;
        gl_PointSize = a_PointSize;
    }
`;
let FSHADER_SOURCE = `
    void main(){
        gl_FragColor = vec4(1.0,0.0,0.0,1.0);
    }

`;
function main() {
    let canvas = document.getElementById('webgl');
    let gl = getWebGLContext(canvas);
    let init = !initShaders(gl, VSHADER_SOURCE, FSHADER_SOURCE)
    if (init) {
        return console.error('error');
    }

    let a_Position = gl.getAttribLocation(gl.program, 'a_Position');
    let a_PointSize = gl.getAttribLocation(gl.program, 'a_PointSize');
    if (a_Position < 0) {
        return console.log(123);
    }
    let position = new Float32Array([10.0, 10.0, 0.0])
    let pointSize = 10.0;

    // gl.vertexAttrib3f(a_Position, 0.0,0.0,0.0);
    gl.vertexAttrib3fv(a_Position, position);
    gl.vertexAttrib1f(a_PointSize, pointSize);

    /**
     *  gl.vertexAttrib3f中 
     * 基础函数名 vertexAttrib
     * 参数个数 3
     * 参数类型 f (float，浮点数类型)
     *  gl.vertexAttrib3fv
     * 如果函数后面跟着一个v 表示函数可以接收数组作为参数 
     */

    gl.clearColor(0.0, 0.5, 0.8, 1.0);
    gl.clear(gl.COLOR_BUFFER_BIT);
    gl.drawArrays(gl.POINTS, 0, 1);
}